log using S20_S27_FE_PoissonCRE.smcl,replace
use  NER_panel_data.dta, clear
gen country=1
append using NIGERIA_panel_data.dta
replace country=2 if country ==.

append using ETHIOPIA_panel_data.dta
replace country=3 if country ==.

append using UGA_panel_data.dta
replace country=4 if country ==.

append using TZA_panel_data.dta
replace country=5 if country ==.

append using MWI_panel_data.dta
replace country=6 if country ==.

xtset HHID_panel year

label define country 1 "Niger" 2 "Nigeria" 3 "Ethiopia" 4 "Uganda" 5 "Tanzania" 6 "Malawi"
label values country country

tab year, generate(year_)
global year_NIGER year_4
global year_NIGERIA year_3 year_5 year_8
global year_ETHIOPIA year_6
global year_UGANDA   year_3 year_4 year_6 year_8 year_10
global year_TANZANIA year_1 year_5 year_7
global year_MALAWI year_3 year_6 
global xlist hhsize dependent_share head_age female_head head_read  motobike phone  electricity wagejob enterprise weather_shock  plot_area other_crop


********************************************************************************
*                                   S20                                        *
********************************************************************************
eststo clear
xtreg hdd9  no_species   $xlist    i.year  , cluster(HHID_panel)  fe
eststo est1


xtreg hdd9  no_species   $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  no_species   $xlist   $year_MALAWI if country==6, cluster(HHID_panel)  fe
eststo est3


xtreg hdd9  no_species   $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  no_species   $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  no_species   $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6

xtreg hdd9  no_species   $xlist   $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7

esttab using  s20_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 



********************************************************************************
*                                   S21                                        *
********************************************************************************
eststo clear
xtreg hdd9  pdd9   $xlist     i.year, cluster(HHID_panel)  fe
eststo est1

xtreg hdd9  pdd9   $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  pdd9   $xlist   $year_MALAWI if country==6, cluster(HHID_panel)  fe
eststo est3


xtreg hdd9  pdd9   $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  pdd9   $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  pdd9   $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6

xtreg hdd9  pdd9   $xlist    $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7
esttab using  s21_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 









********************************************************************************
*                                   S22                                        *
********************************************************************************
preserve
eststo clear
drop if hdd9_own==.|hdd9_purchase==.

eststo clear
xtreg hdd9_own  pdd9   $xlist    i.year  , cluster(HHID_panel)  fe
eststo est1


xtreg hdd9_own  pdd9   $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9_own  pdd9   $xlist   $year_MALAWI if country==6, cluster(HHID_panel)  fe
eststo est3

xtreg hdd9_own  pdd9   $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9_own  pdd9   $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9_own  pdd9   $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9_own  pdd9   $xlist    $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7
esttab using  S22_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 





********************************************************************************
*                                   S23                                        *
********************************************************************************
eststo clear
xtreg hdd9_purchase  pdd9   $xlist    i.year  , cluster(HHID_panel)  fe
eststo est1


xtreg hdd9_purchase  pdd9   $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9_purchase  pdd9   $xlist   $year_MALAWI if country==6, cluster(HHID_panel)  fe
eststo est3

xtreg hdd9_purchase  pdd9   $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9_purchase  pdd9   $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9_purchase  pdd9   $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9_purchase  pdd9   $xlist   $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7

esttab using  S23_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 
restore






********************************************************************************
*                                  S24                                         *
********************************************************************************
preserve
drop if sum_vill<=1|sum_vill==.

*                                  hh_level                                    *
eststo clear
xtreg hdd9  pdd9   $xlist    i.year  , cluster(HHID_panel)  fe
eststo est1

xtreg hdd9  pdd9   $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  pdd9   $xlist   $year_MALAWI if country==6, cluster(HHID_panel)  fe
eststo est3


xtreg hdd9  pdd9   $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  pdd9   $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  pdd9   $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9  pdd9   $xlist    $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7


esttab using  S24_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 





********************************************************************************
*                                  S25                                         *
********************************************************************************
eststo clear
xtreg hdd9  pdd9_vill sum_vill  $xlist   i.year    , cluster(HHID_panel)  fe
eststo est1

xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_MALAWI  if country==6, cluster(HHID_panel)  fe
eststo est3

xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9  pdd9_vill sum_vill  $xlist   $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7
esttab using  S25_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 






********************************************************************************
*                                  S26                                         *
********************************************************************************
eststo clear
xtreg hdd9  pdd9_town sum_town  $xlist   i.year   , cluster(HHID_panel)  fe
eststo est1

xtreg hdd9  pdd9_town sum_town  $xlist   $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  pdd9_town sum_town  $xlist   $year_MALAWI  if country==6, cluster(HHID_panel)  fe
eststo est3

xtreg hdd9 pdd9_town sum_town  $xlist    $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  pdd9_town sum_town  $xlist   $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  pdd9_town sum_town  $xlist   $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9  pdd9_town sum_town  $xlist   $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7
esttab using  S26_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 



********************************************************************************
*                                  S27                                         *
********************************************************************************
eststo clear
xtreg hdd9  pdd9_dist  sum_dist  $xlist   i.year   , cluster(HHID_panel)  fe
eststo est1

xtreg hdd9  pdd9_dist  sum_dist  $xlist  $year_ETHIOPIA if country==3, cluster(HHID_panel)  fe
eststo est2

xtreg hdd9  pdd9_dist  sum_dist  $xlist  $year_MALAWI  if country==6, cluster(HHID_panel)  fe
eststo est3

xtreg hdd9 pdd9_dist  sum_dist  $xlist  $year_NIGER if country==1, cluster(HHID_panel)  fe
eststo est4


xtreg hdd9  pdd9_dist  sum_dist  $xlist  $year_NIGERIA if country==2, cluster(HHID_panel)  fe
eststo est5


xtreg hdd9  pdd9_dist  sum_dist  $xlist  $year_TANZANIA if country==5, cluster(HHID_panel)  fe
eststo est6


xtreg hdd9  pdd9_dist  sum_dist  $xlist  $year_UGANDA if country==4, cluster(HHID_panel)  fe
eststo est7
esttab using  S27_fe.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) 
restore



























********************************************************************************
*                                 Poisson CRE                                  *
********************************************************************************
foreach x of varlist hhsize dependent_share head_age female_head head_read  motobike phone  electricity wagejob enterprise weather_shock  plot_area other_crop hdd9 pdd9 no_species{
egen `x'_mean=mean(`x'), by(HHID_panel)
}
global xlist hhsize dependent_share head_age female_head head_read  motobike phone  electricity wagejob enterprise weather_shock  plot_area other_crop  motobike_mean phone_mean electricity_mean wagejob_mean enterprise_mean  



********************************************************************************
*                                   S20                                        *
********************************************************************************
eststo clear
poisson hdd9  no_species   $xlist  no_species_mean i.country i.year  , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1


poisson hdd9  no_species   $xlist  no_species_mean $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  no_species   $xlist  no_species_mean $year_MALAWI if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3


poisson hdd9  no_species   $xlist  no_species_mean $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  no_species   $xlist  no_species_mean $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  no_species   $xlist  no_species_mean $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6

poisson hdd9  no_species   $xlist  no_species_mean  $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7

esttab using  S20_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(no_species   $xlist  no_species_mean)  



********************************************************************************
*                                   S21                                        *
********************************************************************************
eststo clear

poisson hdd9  pdd9   $xlist   pdd9_mean i.country i.year, cluster(HHID_panel)
margins, dydx(*) post 
eststo est1


poisson hdd9  pdd9   $xlist  pdd9_mean $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  pdd9   $xlist  pdd9_mean $year_MALAWI if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3


poisson hdd9  pdd9   $xlist  pdd9_mean $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  pdd9   $xlist  pdd9_mean $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  pdd9   $xlist  pdd9_mean $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6

poisson hdd9  pdd9   $xlist  pdd9_mean  $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S21_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9   $xlist  pdd9_mean  )



********************************************************************************
*                                   S22                                        *
********************************************************************************
preserve
eststo clear
drop if hdd9_own==.|hdd9_purchase==.
drop  pdd9_mean no_species_mean hhsize_mean dependent_share_mean head_age_mean female_head_mean head_read_mean motobike_mean phone_mean electricity_mean wagejob_mean enterprise_mean weather_shock_mean plot_area_mean other_crop_mean
foreach x of varlist pdd9 hhsize dependent_share head_age female_head head_read  motobike phone  electricity wagejob enterprise weather_shock  plot_area other_crop{
egen `x'_mean=mean(`x'), by(HHID_panel)
}


eststo clear
poisson hdd9_own  pdd9   $xlist  pdd9_mean i.country i.year  , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1


poisson hdd9_own  pdd9   $xlist  pdd9_mean $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9_own  pdd9   $xlist  pdd9_mean $year_MALAWI if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3

poisson hdd9_own  pdd9   $xlist  pdd9_mean $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9_own  pdd9   $xlist  pdd9_mean $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9_own  pdd9   $xlist  pdd9_mean $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6


poisson hdd9_own  pdd9   $xlist  pdd9_mean  $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S22_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9   $xlist  pdd9_mean  )




********************************************************************************
*                                   S23                                        *
********************************************************************************
eststo clear
poisson hdd9_purchase  pdd9   $xlist  pdd9_mean i.country i.year  , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1


poisson hdd9_purchase  pdd9   $xlist  pdd9_mean $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9_purchase  pdd9   $xlist  pdd9_mean $year_MALAWI if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3

poisson hdd9_purchase  pdd9   $xlist  pdd9_mean $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9_purchase  pdd9   $xlist  pdd9_mean $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9_purchase  pdd9   $xlist  pdd9_mean $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6


poisson hdd9_purchase  pdd9   $xlist  pdd9_mean  $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7

esttab using  S23_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9   $xlist  pdd9_mean  )
restore









********************************************************************************
*                                   S24                                        *
********************************************************************************
preserve
drop if sum_vill<=1|sum_vill==.

drop pdd9_mean no_species_mean hhsize_mean dependent_share_mean head_age_mean female_head_mean head_read_mean motobike_mean phone_mean electricity_mean wagejob_mean enterprise_mean weather_shock_mean plot_area_mean other_crop_mean
egen pdd9_mean=mean(pdd9), by(HHID_panel)
egen pdd9_mean_vill=mean(pdd9_vill), by(HHID_panel)
egen pdd9_mean_town=mean(pdd9_town), by(HHID_panel)
egen pdd9_mean_dist=mean(pdd9_dist), by(HHID_panel)

foreach x of varlist hhsize dependent_share head_age female_head head_read  motobike phone  electricity wagejob enterprise weather_shock  plot_area other_crop{
egen `x'_mean=mean(`x'), by(HHID_panel)
}


*                                  hh_level                                    *
eststo clear
poisson hdd9  pdd9   $xlist  pdd9_mean i.country i.year  , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1

poisson hdd9  pdd9   $xlist  pdd9_mean $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  pdd9   $xlist  pdd9_mean $year_MALAWI if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3


poisson hdd9  pdd9   $xlist  pdd9_mean $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  pdd9   $xlist  pdd9_mean $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  pdd9   $xlist  pdd9_mean $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6


poisson hdd9  pdd9   $xlist  pdd9_mean  $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S24_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9   $xlist  pdd9_mean   )




********************************************************************************
*                                   S25                                        *
********************************************************************************
*                          vill_village_level                                  *

eststo clear
poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill i.country i.year   , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1

poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_MALAWI  if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3

poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6


poisson hdd9  pdd9_vill sum_vill  $xlist  pdd9_mean_vill $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S25_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9_vill    $xlist  pdd9_mean_vill sum_vill  )





********************************************************************************
*                                   S26                                        *
********************************************************************************
*                          town_village_level                                  *
eststo clear
poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town i.country i.year   , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1

poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town $year_MALAWI  if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3

poisson hdd9 pdd9_town sum_town  $xlist  pdd9_mean_town $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town $year_TANZANIA if country==5, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est6


poisson hdd9  pdd9_town sum_town  $xlist  pdd9_mean_town $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S26_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9_town    $xlist  pdd9_mean_town sum_town  )



********************************************************************************
*                                   S27                                        *
********************************************************************************
*                          dist_village_level                                  *

eststo clear
poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist i.country i.year   , cluster(HHID_panel) 
margins, dydx(*) post 
eststo est1

poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_ETHIOPIA if country==3, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est2

poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_MALAWI  if country==6, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est3

poisson hdd9 pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_NIGER if country==1, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est4


poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_NIGERIA if country==2, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est5


poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_TANZANIA if country==5, cluster(HHID_panel)
margins, dydx(*) post  
eststo est6


poisson hdd9  pdd9_dist  sum_dist  $xlist pdd9_mean_dist $year_UGANDA if country==4, cluster(HHID_panel) 
margins, dydx(*) post 
eststo est7
esttab using  S27_poisson.rtf, se replace star(* 0.1 ** 0.05 *** 0.01) cells (b(star fmt(%9.3f)) se (par(( )) fmt(%9.3f)))  stats(N r2_b  r2_w r2_o p, fmt(%4.0f %4.3f %4.3f %6.3f)) keep(pdd9_dist    $xlist  pdd9_mean_dist sum_dist)
restore
log close






